package com.ljh.jxc.modules.suo.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ljh.jxc.modules.suo.entity.Purchasereturn;
import com.ljh.jxc.modules.suo.service.PurchasereturnService;
import com.ljh.jxc.common.utils.PageUtils;
import com.ljh.jxc.common.utils.R;



/**
 * 采购退货单
 *
 * @author liujinghui
 * @email liujinghui@163.com
 * @date 2021-12-01 14:17:34
 */
@RestController
@RequestMapping("jxc/purchasereturn")
public class PurchasereturnController {
    @Autowired
    private PurchasereturnService purchasereturnService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("jxc:purchasereturn:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = purchasereturnService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{purchasereturnId}")
    @RequiresPermissions("jxc:purchasereturn:info")
    public R info(@PathVariable("purchasereturnId") String purchasereturnId){
		Purchasereturn purchasereturn = purchasereturnService.getById(purchasereturnId);

        return R.ok().put("purchasereturn", purchasereturn);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("jxc:purchasereturn:save")
    public R save(@RequestBody Purchasereturn purchasereturn){
		purchasereturnService.save(purchasereturn);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("jxc:purchasereturn:update")
    public R update(@RequestBody Purchasereturn purchasereturn){
		purchasereturnService.updateById(purchasereturn);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("jxc:purchasereturn:delete")
    public R delete(@RequestBody String[] purchasereturnIds){
		purchasereturnService.removeByIds(Arrays.asList(purchasereturnIds));

        return R.ok();
    }

}
